home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
ca29_3.zip
/
BBMAINT3.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-03-24
|
24KB
|
914 lines
;**** TRACE ON ; Debugging
;
; ----- COM-AND BBS file maintenance script (BULLETIN file)
; Commenced: 11/90 R.McG
; -----------------------------------------------------------------------
; Purpose:
; The script, named BBMAINT3.CMD, produces the main window for
; Bulletin functions of BBMAINT, and implements its functions. It
; is not directly callable itself.
; -----------------------------------------------------------------------
; Usage:
; N99 -> Text attribute value (Setup by BBMAINT.CMD)
; N98 -> BBMAINT Mainline cursor position
; N97 -> BBMAINT Mainline cursor position
; N96 -> our mainline cursor position
; N95 -> our mainline cursor position
; -----------------------------------------------------------------------
;
; This script is intended ONLY to be used for FCALL
;
IF NOT FCALLED
WOPEN 10,10,13,70 (cont) NOBUEsc
ATSAY 10,12 (cont) " BBS Bulletin "
ATSAY 11,12 (cont) " The script: "*"_SCRIPT"
ATSAY 12,12 (cont) " is not used by itself... it is called through BBMAINT"
ATSAY 13,26 (cont) " Press any key to continue "
;
; Wait a keypress
;
KEYGET S0 ; Wait for any key
WCLOSE ; Close open window
EXIT ; Terminate right here
ENDIF
GOSUB Bullfile ; Invoke function
FRETURN ; Return to caller
; -----------------------------------------------------------------------
; ----- NoBull: Inform that there's no BBS-Bull file to modify
;
NoBull:
WOPEN 10,10,13,70 (cont) NOBUEsc
ATSAY 10,12 (cont) " BBS BullDir "
ATSAY 11,12 (cont) " The file: "*S25&"\BBS-Bull"
ATSAY 12,12 (cont) " does not exist. Please create subdirectories first."
ATSAY 13,26 (cont) " Press any key to continue "
;
; Wait a keypress
;
KEYGET S0 ; Wait for any key
WCLOSE
NOBUEsc:
RETURN
; -----------------------------------------------------------------------
; ----- Subroutine: BullFile -> Update Bulletin directory
;
BullFile:
GOSUB NewBull ; Create if not there
IF NOT ISFILE S25&"\BBS-Bull"
GOSUB NoBull ; Inform there's no file
RETURN ; .. so we can't continue
ENDIF
;
; Open a window
;
WOPEN 0,0 23,79 (defa) Bull_Esc
ATSAY 0,2 (defa) " BBS Bulletins "
ATSAY 23,25 (defa) " Press ESC to cancel BBMAINT "
;
; Paint the window
;
BUFI100:
CLEAR ; Clear window
LOCATE 2,2
MESS " 1) Add a bulletin to the list"
MESS " 2) Delete a bulletin from the list"
MESS " 3) Modify a bulletin's listing"
MESS " 4) Print the bulletin list"
MESS " 5) View the bulletin list"
MESS "──────────────────────────────────── "
MESS "Note: Alt-Q to edit a file"
MESS " Alt-F for a directory search"
MESS " Alt-F10 to shell to DOS"
MESS " "
MESS "──────────────────────────────────── "
MESS " "
MESS "Select item (carriage return = previous): "
CURSOR N96,N95 ; Read current cursor
;
; Wait for entry, and interpret
;
BUFI200:
LOCATE N96 N95 ; Reposition cursor
KEYGET S0 ; Wait for it
SWITCH S0 ; Act according to keyget
CASE "1"
GOSUB AddBull
ENDCASE
CASE "2"
GOSUB DelBull
ENDCASE
CASE "3"
GOSUB ModBull
ENDCASE
CASE "4"
GOSUB PrnBull
ENDCASE
CASE "5"
GOSUB ViewBull
GOTO BUFI100 ; Repaint screen after this
ENDCASE
CASE "0d" ; c/r alone is exit
WCLOSE ; Close window...
RETURN ; and return to caller
ENDCASE
CASE "_NULL" ; ESC -> Null
WCLOSE ; Close window...
RETURN ; Leave Main routine
ENDCASE
CASE "2100" ; Alt-F
MANUAL "0x2100" ; Perform Dir cmd
ENDCASE
CASE "1000" ; Alt-Q
MANUAL "0x1000" ; Edit a file
ENDCASE
CASE "7100" ; Alt-F10
SHELL
DWINDOW 1,2,22,78; Reset dwindow after shell
LEGEND "_LEGEND" ; Redo the legend
ENDCASE
DEFAULT ; None of the above
SOUND 100,100 ; Bronx cheer
ENDCASE
ENDSWITCH
GOTO BUFI200 ; Repaint screen and ask again
;
; End of bulletin procedure
;
Bull_Esc:
S0 = "" ; Fake a null entry
RETURN ; Leave bulletin routine
; -----------------------------------------------------------------------
; ----- AddBUll: Add a file to the bulletin directory
;
AddBull:
SET FLAG(0) OFF ; Flag for ESCAPE
WOPEN 10,10,17,75 (cont) ADBUEsc
ATSAY 10,12 (cont) " BBS Bulletin Add "
ATSAY 11,12 (cont) "Enter the bulletin number: "
ATSAY 17,26 (cont) " Press ESC to cancel "
;
; Wait a keypress
;
LOCATE 11,42
GET S0 5 ; get number
IF FLAG(0) GOTO ADBUEnd ; Exit if ESC hit
LJ S0 ; Left justify
UPPER S0 ; Upper casefy
IF NULL S0 GOTO ADBUEnd ; get out on empty entry
GOSUB LkpBull ; Lookup name in file
IF FOUND ; If its there we can't add it
WCLOSE ; Close open window
GOTO ModBU_Add ; Skip if found
ENDIF
S10 = S0 ; Save File name
GOTO ADBU100 ; And branch around parallel code
;
; Entry from ModBull... Nothing to modify
;
AddBU_Mod:
WOPEN 10,10,17,75 (cont) ADBUEsc
ATSAY 10,12 (cont) " BBS Bulletin Add "
ATSAY 11,12 (cont) "Enter the bulletin number: "
ATSAY 11,42 (cont) S0
ATSAY 17,26 (cont) " Press ESC to cancel "
S10 = S0 ; Copy it for remainder
;
; Place file date and time in record
;
ADBU100:
DATE S1 ; Want mm/dd/yy form
S10(5:12) = S1 ; Save date added
ATSAY 12,12 (cont) "Enter the file name:"
LOCATE 12,42
GET S0 12 ; get file name
IF FLAG(0) GOTO ADBUEnd ; Exit if ESC hit
LJ S0 ; Left justify
IF NULL S0
SOUND 100,100 ; Indicate displeasure
GOTO ADBU100 ; Try again
ENDIF
FFIRST S25&"\"*S0 ; Test for file's existence
S10(14:25) = S0 ; Save File name
IF SUCCESS GOTO ADBU200 ; Skip if exists
;
; File does not exist...
;
ADBU110:
ATSAY 13,12 (cont) "File d.n.e. Add anyway (y/n): "
LOCATE 13,42
GET S0 1 ; get resp
IF FLAG(0) GOTO ADBUEnd ; Exit if ESC hit
IF NULL S0 or NOT FIND "YN" S0(0)
SOUND 100,100 ; Indicate displeasure
GOTO ADBU110 ; Try again
ENDIF
IF FIND "N" S0(0)
WCLOSE ; Close window
GOTO AddBull ; And try again
ENDIF
;
; Ask for a comment field
;
ADBU200:
ATSAY 14,12 (cont) "Description: "
LOCATE 14,26
GET S0 40 ; get resp
LJ S0 ; Left justify
IF FLAG(0) GOTO ADBUEnd ; Exit if ESC hit
IF NULL S0
SOUND 100,100 ; Indicate displeasure
GOTO ADBU200 ; Try again
ENDIF
S10(26:79) = S0 ; Save comment text
;
; Ask for privileged flag
;
ADBU250:
ATSAY 15,12 (cont) "Priveleged access (y/n): "
LOCATE 15,42
GET S0 1 ; get resp
IF FLAG(0) GOTO ADBUEnd ; Exit if ESC hit
IF NULL S0 or NOT FIND "YN" S0(0)
SOUND 100,100 ; Indicate displeasure
GOTO ADBU250 ; Try again
ENDIF
IF FIND "Y" S0(0) S10(13:13) = "P" ; Save priveleged access
;
; Ask for one more look
;
ADBU300:
ATSAY 16,12 (cont) "OK to add this record?: "
LOCATE 16,42
GET S0 1 ; get resp
IF FLAG(0) GOTO ADBUEnd ; Exit if ESC hit
IF NULL S0 or NOT FIND "YN" S0(0)
SOUND 100,100 ; Indicate displeasure
GOTO ADBU300 ; Try again
ENDIF
IF FIND "N" S0(0)
WCLOSE ; Close window
GOTO AddBull ; And try again
ENDIF
;
; Write the record
;
GOSUB AddBRec ; Write to Bulletins file
;
; End of add procedure
;
ADBUEnd:
WCLOSE
ADBUEsc:
SET FLAG(0) ON
RETURN
; -----------------------------------------------------------------------
; ----- AddBRec: Add a record to the Bulletin file...
; .. S10 passes the record to be written
;
AddBRec:
FOPENO S25&"\BBS-bull" TEXT APPEND
IF NOT SUCCESS ; Open failed
S0 = "Error opening: "*S25&"\BBS-Bull"
GOSUB Error ; Report
RETURN ; And we're done
ENDIF
PRESERVE S10 ; Preserve ^'s and !'s
WRITE S10 ; Write the record
WRITE "!^Z" ; And finish it
FCLOSEO
RETURN
; -----------------------------------------------------------------------
; ----- LkpFile: Lookup a file in the BBS-Bull file
; .. S0 passes the fname to be tested
; .. S10 returns the record read
;
LkpBul